package Day18;

import java.util.*;
// 1:无需package
// 2: 类名必须Main, 不可修改

public class Main1 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int n = scan.nextInt();
        long x = scan.nextLong();
        long[] arr = new long[n];
        for(int i = 0; i < n; i++){
          arr[i] = scan.nextLong();
        }
        Arrays.sort(arr);
        long sum = 0;
        for(int i = 0; i < n; i++){
          sum += arr[i] - (i * x) > 0 ? arr[i] - (i * x) : 0;
        }
        System.out.println(sum);
        scan.close();
    }
}